package com.lyx.bloomfilterdemo.Bloomfilter;

import java.util.Arrays;
import java.util.List;

/**
 * Created by Intellij IDEA.
 * User:   LYX
 * Date:  2023/6/25
 */
public class BloomfilterTest {
    public static void main(String[] args) {


        List<String> strings = Arrays.asList("JAVA", "JVM", "Redis", "MySQL", "GG");
        BloomFilter filter = new BloomFilter(1000, 5);

        // 将所有字符串添加到布隆过滤器中
        for (String s : strings) {
            filter.add(s);
        }

        String[] queries = {"GG", "MySQL", "JVM", "java"};
        for (String query : queries) {
            System.out.println("是否包含:" + query + "-" + filter.contains(query));
        }
    }
}
